class CreateStudents < ActiveRecord::Migration
  def self.up
    create_table :students do |t|
      t.integer :id, :references => :person
      t.string :registration_code
      t.date :admission_date
      t.timestamps
    end
    add_index(:students, :registration_code, :unique => true)
    add_index(:students, [:id, :registration_code], :unique => true)
  end

  def self.down
    remove_index(:students, :column => :registration_code)
    drop_table :students
  end
end
